; Music of Robin Hood (1986) (Codemasters) (Jon Paul Eldridge)
; Ripped by Megachur the 27/02/2009

; Need System Vectors

	write "ROBINHOO.BIN"

music_date_rip	equ &1b29
music_adr	equ &87ed
first_theme	equ 0
last_theme	equ 0	; 0 -> 0

	read "music_header_v1_0.asm"

.l87ed
	ld a,#01
	ld hl,l8823
	call #bcbf
	ld a,#02
	ld hl,l882a
	call #bcbf
	ld a,#01
	ld hl,l882e
	call #bcbc
	ld a,#02
	ld hl,l8835
	call #bcbc
	ld a,#03
	ld hl,l883c
	call #bcbc
	ld hl,l8a37
	ld b,#81
	ld c,#00
	ld de,l88c3
	call #bcd7
	ret
.l882a equ $ + 7
.l8823
	db #82,#03,#ff,#01,#03,#01,#01,#82
.l882e equ $ + 3
	db #00,#00,#00,#02,#01,#ff,#05,#0d
.l8835 equ $ + 2
	db #ff,#05,#02,#01,#ff,#03,#0c,#ff
.l883c equ $ + 1
	db #03,#02,#01,#ff,#04,#09,#ff,#04
.l884a equ $ + 7
.l8847 equ $ + 4
.l8845 equ $ + 2
.l8843
	db #02,#01,#ff,#01,#ff,#ff,#05,#02
.l8851 equ $ + 6
.l884e equ $ + 3
.l884c equ $ + 1
	db #01,#ff,#01,#ff,#ff,#03,#02,#01
.l885a equ $ + 7
.l8859 equ $ + 6
.l8858 equ $ + 5
.l8855 equ $ + 2
.l8853
	db #ff,#01,#ff,#ff,#04,#00,#00,#00
	db #00
	ld a,#0d
	ld (l8858),a
	ld a,#0c
	ld (l8859),a
	ld a,#09
	ld (l885a),a
	ld b,#08
.l886d
	push bc
	ld hl,l8858
	ld a,#0e
	sub (hl)
	neg
	ld (l8845),a
	ld a,(hl)
	ld (l8847),a
	dec (hl)
	inc hl
	ld a,#0d
	sub (hl)
	neg
	ld (l884c),a
	ld a,(hl)
	ld (l884e),a
	dec (hl)
	inc hl
	ld a,#0a
	sub (hl)
	neg
	ld (l8853),a
	ld a,(hl)
	ld (l8855),a
	dec (hl)
	ld a,#01
	ld hl,l8843
	call #bcbc
	ld a,#02
	ld hl,l884a
	call #bcbc
	ld a,#03
	ld hl,l8851
	call #bcbc
	ld b,#1e
.l88b4
	call #bd19
	djnz l88b4
	pop bc
	djnz l886d
	ld hl,l8a37
	call #bcdd
	ret
;
.play_music
.l88c3
;
	push af
	ld a,(l8a15)
	dec a
	dec a
	ld (l8a15),a
	ld a,#00
	call z,l88ed
	ld a,(l8a25)
	dec a
	dec a
	ld (l8a25),a
	ld a,#01
	call z,l88ed
	ld a,(l8a35)
	dec a
	dec a
	ld (l8a35),a
	ld a,#02
	call z,l88ed
	pop af
	ret
.l88ed
	push bc
	push de
	push hl
	push ix
	push iy
	ld b,#00
	add a
	add a
	add a
	add a
	ld c,a
	ld iy,l8a07
	add iy,bc
.l8901
	ld l,(iy+#0c)
	ld h,(iy+#0d)
	push hl
	pop ix
.l890a
	ld a,(ix+#00)
	cp #ff
	jr z,l8982
	cp #fe
	jr z,l8991
	cp #fd
	jp z,l89a1
	cp #fc
	jr z,l8999
	cp #fb
	jr z,l897a
	cp #fa
	jp z,l89a9
	ld a,(ix+#00)
	ld hl,l8a40
	sla a
	ld b,#00
	ld c,a
	add hl,bc
	ld a,(hl)
	ld (iy+#03),a
	inc hl
	ld a,(hl)
	ld (iy+#04),a
	ld a,(ix+#01)
	ld (iy+#07),a
	ld (iy+#0e),a
	ld l,(iy+#0c)
	ld h,(iy+#0d)
	inc hl
	inc hl
	ld (iy+#0c),l
	ld (iy+#0d),h
	push iy
	pop hl
	call #bcaa
	pop iy
	pop ix
	pop hl
	pop de
	pop bc
	ret
.l8961
	ld a,#00
	ld (iy+#09),a
.l8966
	ld l,(iy+#0c)
	ld h,(iy+#0d)
	inc hl
	inc hl
	inc ix
	inc ix
.l8972
	ld (iy+#0c),l
	ld (iy+#0d),h
	jr l890a
.l897a
	ld a,(ix+#01)
	ld (iy+#05),a
	jr l8966
.l8982
	ld a,(iy+#0a)
	ld (iy+#0c),a
	ld a,(iy+#0b)
	ld (iy+#0d),a
	jp l8901
.l8991
	ld a,(ix+#01)
	ld (iy+#01),a
	jr l8966
.l8999
	ld a,(ix+#01)
	ld (iy+#02),a
	jr l8966
.l89a1
	ld a,(ix+#01)
	ld (iy+#06),a
	jr l8966
.l89a9
	ld a,(iy+#09)
	cp #01
	jr z,l89bd
	ld a,#01
	ld (iy+#09),a
	ld a,(ix+#01)
	and #0f
	ld (iy+#0f),a
.l89bd
	ld a,(iy+#0f)
	cp #00
	jr z,l8961
	dec a
	ld (iy+#0f),a
	ld a,(ix+#01)
	and #f0
	rrca
	rrca
	rrca
	ld b,#00
	ld c,a
	push ix
	pop hl
	sbc hl,bc
	push hl
	pop ix
	jr l8972
.l89dd
	ld hl,(l8a11)
	ld (l8a13),hl
	ld hl,(l8a21)
	ld (l8a23),hl
	ld hl,(l8a31)
	ld (l8a33),hl
	ld hl,#0002
	ld (l8a15),hl
	ld (l8a25),hl
	ld (l8a35),hl
	ld a,#00
	ld (l8a10),a
	ld (l8a20),a
	ld (l8a30),a
	ret
.l8a07
	db #01,#00,#00,#00,#00,#00,#00,#00
.l8a10 equ $ + 1
	db #00,#00
.l8a13 equ $ + 2
.l8a11
	dw l8aba,l8aba
.l8a15
	db #02,#00,#02,#00,#00,#00,#00,#00
.l8a20 equ $ + 3
	db #00,#00,#00,#00
.l8a23 equ $ + 2
.l8a21
	dw l8c7f,l8c7f
.l8a25
	db #02,#00,#04,#00,#00,#00,#00,#00
.l8a30 equ $ + 3
	db #00,#00,#00,#00
.l8a33 equ $ + 2
.l8a31
	dw l8cba,l8cba
.l8a37 equ $ + 2
.l8a35
	db #02,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00
.l8a40
	dw #03bc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01de,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #003c,#0038,#0035,#0032
	dw #002f,#002d,#002a,#0028
	dw #0026,#0024,#0022,#0020
	dw #0000
.l8aba
	db #fd,#0f,#fe,#01,#fc,#01,#fb,#00
	db #0c,#18,#18,#18,#1c,#18,#fa,#31
	db #0c,#18,#09,#18,#07,#18,#13,#18
	db #17,#18,#fa,#31,#07,#18,#06,#18
	db #04,#18,#10,#18,#13,#18,#fa,#31
	db #04,#18,#06,#18,#07,#18,#13,#18
	db #17,#18,#fa,#31,#07,#18,#0b,#18
	db #0c,#18,#18,#18,#1c,#18,#fa,#31
	db #0c,#18,#09,#18,#07,#18,#13,#18
	db #17,#18,#fa,#31,#07,#18,#08,#18
	db #09,#18,#15,#18,#18,#18,#fa,#31
	db #09,#18,#07,#18,#05,#18,#11,#18
	db #15,#18,#07,#18,#13,#18,#17,#18
	db #07,#18,#0b,#18,#0c,#18,#18,#18
	db #1c,#18,#0c,#18,#18,#18,#1c,#18
	db #0c,#18,#18,#18,#05,#18,#11,#18
	db #15,#18,#07,#18,#13,#18,#17,#18
	db #07,#18,#13,#18,#0c,#18,#18,#18
	db #1c,#18,#0c,#18,#18,#18,#1c,#18
	db #0c,#18,#18,#18,#05,#18,#11,#18
	db #15,#18,#07,#18,#13,#18,#17,#18
	db #07,#18,#13,#18,#05,#18,#11,#18
	db #15,#18,#05,#18,#11,#18,#15,#18
	db #05,#18,#11,#18,#07,#18,#13,#18
	db #17,#18,#07,#18,#13,#18,#17,#18
	db #13,#0c,#11,#0c,#10,#0c,#0e,#0c
	db #0c,#18,#18,#18,#1c,#18,#fa,#31
	db #0c,#18,#18,#18,#09,#18,#15,#18
	db #18,#18,#09,#18,#15,#18,#18,#18
	db #09,#18,#15,#18,#10,#18,#1c,#18
	db #1f,#18,#10,#18,#1c,#18,#1f,#18
	db #10,#18,#1c,#18,#0e,#18,#1a,#18
	db #1d,#18,#fa,#31,#0e,#18,#1a,#18
	db #0c,#18,#18,#18,#1c,#18,#0c,#18
	db #18,#18,#1c,#18,#0c,#18,#18,#18
	db #09,#18,#15,#18,#18,#18,#09,#18
	db #15,#18,#18,#18,#09,#18,#15,#18
	db #04,#18,#10,#18,#13,#18,#fa,#31
	db #04,#18,#05,#18,#07,#18,#13,#18
	db #17,#18,#fa,#31,#07,#18,#0b,#d8
	db #0c,#18,#1d,#18,#1c,#18,#0c,#18
	db #1c,#18,#1d,#18,#0c,#18,#1d,#18
	db #0e,#18,#1f,#18,#1d,#18,#0e,#18
	db #1d,#18,#1f,#18,#0e,#18,#1f,#18
	db #13,#18,#24,#18,#23,#18,#13,#18
	db #23,#18,#21,#18,#13,#18,#21,#18
	db #11,#18,#21,#18,#1f,#18,#11,#18
	db #1f,#18,#1d,#18,#11,#18,#10,#0c
	db #0e,#0c,#0c,#18,#1d,#18,#1c,#18
	db #0c,#18,#1a,#18,#1c,#18,#0c,#18
	db #1d,#18,#0c,#18,#1d,#18,#1c,#18
	db #0c,#18,#1a,#18,#1c,#18,#0c,#18
	db #18,#18,#09,#18,#18,#18,#17,#18
	db #09,#18,#15,#18,#17,#18,#09,#18
	db #13,#18,#04,#18,#10,#18,#13,#18
	db #05,#18,#11,#18,#15,#18,#07,#18
.l8c7f equ $ + 5
	db #15,#0c,#17,#cc,#ff,#fc,#00,#fb
	db #08,#fd,#0a,#fe,#03,#3c,#18,#fd
	db #00,#fe,#00,#3c,#18,#fd,#0a,#fe
	db #03,#3c,#18,#fd,#00,#fe,#00,#3c
	db #18,#fd,#0a,#fe,#03,#3c,#18,#fd
	db #00,#fe,#00,#3c,#18,#fd,#0a,#fe
	db #03,#3c,#0c,#fb,#07,#3c,#0c,#fb
	db #08,#3c,#0c,#fb,#07,#3c,#0c,#ff
.l8cba
	db #fd,#0d,#fe,#02,#fc,#02,#fb,#00
	db #24,#30,#24,#30,#24,#18,#fa,#13
	db #1f,#30,#1f,#30,#1f,#18,#fa,#13
	db #1c,#30,#1c,#30,#1c,#18,#fa,#13
	db #1f,#30,#1f,#30,#1f,#18,#fa,#13
	db #24,#30,#24,#30,#24,#18,#fa,#13
	db #1f,#30,#1f,#30,#1f,#18,#fa,#13
	db #21,#30,#21,#30,#21,#18,#fa,#13
	db #1d,#30,#1d,#30,#1d,#18,#fa,#13
	db #24,#0c,#24,#0c,#24,#18,#24,#30
	db #24,#30,#24,#18,#24,#0c,#24,#0c
	db #1d,#0c,#1d,#0c,#1d,#18,#1d,#30
	db #1d,#30,#1d,#18,#1d,#0c,#1d,#0c
	db #24,#0c,#24,#0c,#24,#18,#24,#30
	db #24,#30,#24,#18,#24,#0c,#24,#0c
	db #1d,#0c,#1d,#0c,#1d,#18,#1d,#30
	db #1d,#30,#1d,#18,#1d,#0c,#1d,#0c
	db #1d,#0c,#1d,#0c,#1d,#18,#1d,#30
	db #1d,#30,#1d,#18,#1d,#0c,#1d,#0c
	db #1f,#0c,#1f,#0c,#1f,#18,#1f,#30
	db #1f,#30,#1f,#18,#1f,#0c,#1f,#0c
	db #24,#48,#24,#48,#24,#18,#24,#0c
	db #24,#0c,#21,#48,#21,#48,#21,#18
	db #21,#0c,#21,#0c,#28,#48,#28,#48
	db #28,#18,#28,#0c,#28,#0c,#26,#48
	db #26,#48,#26,#18,#26,#0c,#26,#0c
	db #24,#48,#24,#48,#24,#18,#24,#0c
	db #24,#0c,#21,#48,#21,#48,#21,#18
	db #21,#0c,#21,#0c,#1c,#48,#1c,#48
	db #1c,#18,#1c,#0c,#1c,#0c,#1f,#48
	db #1f,#48,#1f,#18,#1f,#0c,#1f,#cc
	db #24,#30,#24,#18,#24,#18,#24,#30
	db #24,#18,#24,#0c,#24,#0c,#26,#30
	db #26,#18,#26,#18,#26,#30,#26,#18
	db #26,#0c,#26,#0c,#2b,#30,#2b,#18
	db #2b,#18,#2b,#30,#2b,#18,#2b,#0c
	db #2b,#0c,#29,#30,#29,#18,#29,#18
	db #29,#30,#29,#18,#29,#0c,#29,#0c
	db #24,#30,#24,#18,#24,#18,#24,#30
	db #24,#18,#24,#0c,#24,#0c,#24,#30
	db #24,#18,#24,#18,#24,#30,#24,#18
	db #24,#0c,#24,#0c,#21,#30,#21,#18
	db #21,#18,#21,#30,#21,#18,#21,#0c
	db #21,#0c,#1c,#30,#1c,#18,#1c,#18
	db #1c,#30,#1c,#18,#1c,#0c,#1c,#cc
	db #ff,#00,#00
;
.init_music
;
	call l89dd
	jp l87ed
	
;
.game_name
	db "Robin Hood",0
.game_year
	db "1986",0
.game_publisher
	db "Codemasters",0
.music_author
	db "Jon Paul Eldridge",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
